#!/bin/bash

PIMONHOME=${PIMONHOME:-/etc/pi-mon}

cf=$PIMONHOME/conf.d/http.cf
[[ -f $cf ]] || exit 0

out=$(grep -v '^#' $cf | while read url timeout tag
do
    wget -O /dev/null -T $timeout -q $url
    if [[ $? -ne 0 ]]
    then
        echo -n $tag
    fi
done)

[[ -z "$out" ]] && exit 0
echo "H$out"
exit 1
